<?php $this->load->view(TEMPLATE_NAME.'/front/header'); ?>
<?php $this->load->view(TEMPLATE_NAME.'/front/side_left'); ?>
<Script type="text/javascript" language="javascript">
function checkvalidation()
{
	var localnetwork = document.getElementById('network_list').value;
	var nationalnetwork = document.getElementById('national_network_list').value;
	if(localnetwork == "" && document.getElementById('localnet').checked == true)
	{
		document.getElementById('networklistshow').style.display  = 'block';
		return false
	}else {
		document.getElementById('networklistshow').style.display  = 'none';
	}
	
	if(nationalnetwork == "" && document.getElementById('natnetwork').checked == true)
	{
		document.getElementById('nationalnetworklistshow').style.display  = 'block';
		return false
	}else {
		document.getElementById('nationalnetworklistshow').style.display  = 'none';
	}
	
}
</script>

<div class="page">
<h2>Post News </h2>

<!--<div class="clear"></div> -->
<?php $this->load->view(TEMPLATE_NAME.'/front/news_header'); ?>
<!--<div>-->
<?php 
//$insertnewsid = $this->session->userdata('newsid');
//$news_visibility = $this->News_model->get_all_news($insertnewsid);
$attributes = array('class' => 'posts', 'onSubmit' => 'return checkvalidation()'); // for styling
echo form_open('news/news_visibility',$attributes); ?>
<!--<div class="step123" >--> 
<p class="phase"><Strong>Category</Strong> - Where should your news be categorised?</p>
<!--</div>-->
<!--<div>-->
<?php 
$keys[]='';
$values[]='Select Option';
//$networklistings = array(''=> '');
if($networklist)
{
	foreach($networklist as $key=>$value)
	{
		//$tempnetworklistings[$value[id]] = $value['name'];
		$keys[]=$value[id];
		$values[]=$value['name'];
	}
}
$networklistings = array_combine($keys,$values);
 $extra_dropdown = 'class="selectr"';
 if($newscontent[0]['news_visibility'] == 1)
 {
	 $selected1 = "selected";
	 $networkid = $newscontent[0]['network_id'];
 } else {
	 $selected1 = "selected";
	 $networkid = "";
 }
 
 if($newscontent[0]['news_visibility'] == 2)
 {
	 $selected2 = "selected";
 	 $nationalnetworkid = $newscontent[0]['network_id'];
 } else {
	 $selected2 = "";
	 $nationalnetworkid = "";
 } 
 
 if($newscontent[0]['news_visibility'] == 3)
 {
	 $selected3 = "selected";
 } else {
	 $selected3 = "";
 }
	
	
	
 
?>
<!--<div style="float:left;width:20px">--><div class="radios">
<?php
$locnetworklist = 'id = "localnet"';
$natnetworklist = 'id = "natnetwork"';
$national = 	  'id = "nationallist"';
?>
<?php echo form_radio('news_category','1',$selected1,$locnetworklist); ?> <!--</div><div style="float:left"><span class="purple">--> 
<p class="f13"><strong class="f14 purple">Local News Only<!--</span>--></strong> <br />
Make this news visible <strong>ONLY</strong> to members of my network. <strong>Not openely shared.</strong><br />
This is the option for News that is really only relevant to your local network<!--<br />-->
<?php  //echo form_dropdown('network_list',$networklistings,$networkid,$extra_dropdown); ?>
</p><?php  $njs = 'id =  "network_list"'; echo form_dropdown('network_list',$networklistings,$networkid,$njs); ?></div>
<div class="clear"></div>
<div style="background-color: #9F0; color:#000; text-align:center; display:none" id="networklistshow">Select a network from the list to share your news or if none listed then join a network first</div>
<!--<div class="clear"></div>-->
<hr />
<!--<div style="float:left;width:20px">--><div class="radios">
<?php echo form_radio('news_category','2',$selected2,$natnetworklist); ?> <!--</div><div style="float:left"><span class="purple">-->
<p class="f13"><strong class="f14 purple">Local and National News<!--</span>--></strong><br />
Make this news visible to all members of my network as well as the rest of south africa. <br />
This is the option for News relevant or related to your local network, but would also be of interest<!--<br />--> to the rest of South Africa<!--<br />-->
</p><?php $nljs = 'id =  "national_network_list"'; echo form_dropdown('national_network_list',$networklistings,$nationalnetworkid,$nljs); //echo form_dropdown('national_network_list',$networklistings,$nationalnetworkid,$extra_dropdown); ?></div>
<div class="clear"></div>
<div style="background-color: #9F0; color:#000; text-align:center; display:none" id="nationalnetworklistshow">Select a network from the list to share your news or if none listed then join a network first</div>

<!--<div class="clear"></div>-->
<hr />
<!--<div style="float:left;width:20px">--><div class="radios">
<?php echo form_radio('news_category','3',$selected3,$national); ?> <!--</div><div style="float:left"><span class="purple">-->
<p class="f13"><strong class="f14 purple">National News Only<!--</span>--></strong><br />
This news is visible to all - but not directly related to specific Network. <br />
This option is for NEWS that is not linked to any Local Network and is relevant to all of South<!--<br />--> Africa. Often for bigger News items<!--<br />-->
</p></div>
<!--</div>
<div class="clear"></div>-->

<!--<div>--><p class="phase"><Strong>Your identity </Strong>- Display your Name/Nickname or you can choose to be anonymous</p><!--</div>-->
<!--<div class="clear"></div>-->
<?php
if($newscontent[0]['is_anonymous'] == '1')
{
	$selected1 = "";
	$selected2 = "selected";
} else {
	$selected1 = "selected";
	$selected2 = "";
}
?>
<!--<div style="float:left; width:20px">--><div class="radios"> 
<?php echo form_radio('show_name','2',$selected1); ?> <!--</div><div style="float:left"><span class="purple">-->
<p class="f13"><strong class="f14 purple">Display Name/Nickname<!--</span>--></strong><br />
Articles with a real name are read more seriously and you can develop a following</p></div>
<!--<div class="clear"></div>-->
<hr />
<!--<div style="float:left; width:20px">--><div class="radios"><input type="hidden" name="sentnewsid" id="sentnewsid" value="<?php echo  $newscontent[0]['id'] ?>" /><input type="hidden" name="bynetwork" id="bynetwork" value="<?php echo $network_id ?>" />
<?php echo form_radio('show_name','1',$selected2); ?> <!--</div><div style="float:left"><span class="purple">-->
<p class="f13"><strong class="f14 purple">Anonymous<!--</span>--></strong><br /> 
Keep my identity Anonymous and do <strong>NOT</strong> display my identity</p></div>
<!--<div class="clear"></div>-->
<hr style="margin-bottom:0" />
<!--<div>--><?php echo form_submit('step1sub', 'Submit'); ?> <!--</div>-->
<?php echo form_close(); ?>
<!--</div>-->
    <?php $this->load->view(TEMPLATE_NAME.'/front/footer_menu');?>
</div><!-- page -->

<?php $this->load->view(TEMPLATE_NAME.'/front/side_right');?> 
<?php $this->load->view(TEMPLATE_NAME.'/front/footer');?>